import React from "react";
import {TabBarBottom, TabNavigator} from "react-navigation";
import TabBarItem from '../../widget/TabBarItem'
import { HomeStack } from '../home/HomeStack'
import { EntryInnerStack } from '../entry/EntryStack'
import { OutInnerBoundStack } from '../outbound/OutBoundStack'
import { ReturnedInnerStack } from '../returned/ReturnedStack'
import { OwnStack } from '../own/OwnStack'

export const ProducerTab = TabNavigator(
  {
    HomeStack: {
      screen: HomeStack,
      navigationOptions: ({navigation}) => ({
        tabBarLabel: '首页',
        tabBarIcon: ({focused, tintColor}) => (
          <TabBarItem
            tintColor={tintColor}
            focused={focused}
            normalImage={require('../../img/tabbar/pfb_tabbar_homepage@2x.png')}
            selectedImage={require('../../img/tabbar/pfb_tabbar_homepage_selected@2x.png')}
          />
        ),
        header: null
      })
    }
  },
  {
    tabBarComponent: TabBarBottom,
    tabBarPosition: 'bottom',
    swipeEnabled: true,
    animationEnabled: true,
    lazy: true,
    tabBarOptions: {
      activeTintColor: '#39C0E7',
      inactiveTintColor: '#979797',
      style: { backgroundColor: '#ffffff' },
    },
  }
)


export const Tab = TabNavigator(
  {
    HomeStack: {
      screen: HomeStack,
      navigationOptions: ({ navigation }) => ({
        tabBarLabel: '首页',
        tabBarIcon: ({ focused, tintColor }) => (
          <TabBarItem
            tintColor={tintColor}
            focused={focused}
            normalImage={require('../../img/tabbar/pfb_tabbar_homepage@2x.png')}
            selectedImage={require('../../img/tabbar/pfb_tabbar_homepage_selected@2x.png')}
          />
        ),
        header: null
      }),
    },
    EntryInnerStack: { //进库
      screen: EntryInnerStack,
      navigationOptions: ({ navigation }) => ({
        tabBarLabel: '进货',
        tabBarIcon: ({ focused, tintColor }) => (
          <TabBarItem
            tintColor={tintColor}
            focused={focused}
            normalImage={require('../../img/tabbar/pfb_tabbar_entry.png')}
            selectedImage={require('../../img/tabbar/pfb_tabbar_entry_selected.png')}
          />
        ),
        header: null
      }),
    },
    OutInnerBoundStack: { //出库
      screen: OutInnerBoundStack,
      navigationOptions: ({ navigation }) => ({
        tabBarLabel: '出货',
        tabBarIcon: ({ focused, tintColor }) => (
          <TabBarItem
            tintColor={tintColor}
            focused={focused}
            normalImage={require('../../img/tabbar/pfb_tabbar_outbound.png')}
            selectedImage={require('../../img/tabbar/pfb_tabbar_outbound_selected.png')}
          />
        ),
        header: null
      }),
    },
    ReturnedInnerStack: {
      screen: ReturnedInnerStack,
      navigationOptions: ({ navigation }) => ({
        tabBarLabel: '退货',
        tabBarIcon: ({ focused, tintColor }) => (
          <TabBarItem
            tintColor={tintColor}
            focused={focused}
            normalImage={require('../../img/tabbar/pfb_tabbar_returned.png')}
            selectedImage={require('../../img/tabbar/pfb_tabbar_returned_selected.png')}
          />
        ),
        header: null
      }),
    },
    OwnStack: {
      screen: OwnStack,
      navigationOptions: ({ navigation }) => ({
        tabBarLabel: '我的',
        tabBarIcon: ({ focused, tintColor }) => (
          <TabBarItem
            tintColor={tintColor}
            focused={focused}
            normalImage={require('../../img/tabbar/pfb_tabbar_mine@2x.png')}
            selectedImage={require('../../img/tabbar/pfb_tabbar_mine_selected@2x.png')}
          />
        ),
        header: null
      }),
    }
  },
  {
    tabBarComponent: TabBarBottom,
    tabBarPosition: 'bottom',
    swipeEnabled: true,
    animationEnabled: true,
    lazy: true,
    tabBarOptions: {
      activeTintColor: '#39C0E7',
      inactiveTintColor: '#979797',
      style: { backgroundColor: '#ffffff' },
    },
  }
)
